<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Java数组完全指南</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
            min-height: 100vh;
        }
        
        /* 首字下沉效果 */
        .drop-cap::first-letter {
            float: left;
            font-size: 4rem;
            line-height: 3rem;
            padding-right: 0.5rem;
            margin-top: 0.5rem;
            font-weight: 700;
            color: #4f46e5;
            font-family: 'Noto Serif SC', serif;
        }
        
        /* 代码块美化 */
        pre {
            background: #1e293b;
            color: #e2e8f0;
            border-radius: 12px;
            padding: 1.5rem;
            overflow-x: auto;
            position: relative;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
        }
        
        pre::before {
            content: 'Java';
            position: absolute;
            top: 0.5rem;
            right: 1rem;
            font-size: 0.75rem;
            color: #64748b;
            text-transform: uppercase;
            letter-spacing: 0.1em;
        }
        
        /* 卡片悬停效果 */
        .feature-card {
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        }
        
        .feature-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
        }
        
        /* 渐变文字效果 */
        .gradient-text {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }
        
        /* 动画效果 */
        @keyframes fadeInUp {
            from {
                opacity: 0;
                transform: translateY(30px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
        
        .animate-fadeInUp {
            animation: fadeInUp 0.8s ease-out;
        }
        
        /* 滚动显示动画 */
        .scroll-reveal {
            opacity: 0;
            transform: translateY(30px);
            transition: all 0.8s ease-out;
        }
        
        .scroll-reveal.active {
            opacity: 1;
            transform: translateY(0);
        }
        
        /* 标题装饰线 */
        .title-decoration {
            position: relative;
            display: inline-block;
        }
        
        .title-decoration::after {
            content: '';
            position: absolute;
            bottom: -10px;
            left: 0;
            width: 60px;
            height: 4px;
            background: linear-gradient(90deg, #4f46e5 0%, #7c3aed 100%);
            border-radius: 2px;
        }
        
        /* 图片容器样式 */
        .image-container {
            border-radius: 12px;
            overflow: hidden;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
            margin: 2rem 0;
        }
        
        .image-container img {
            width: 100%;
            height: auto;
            display: block;
        }
        
        /* Mermaid图表样式 */
        .mermaid {
            background: white;
            padding: 2rem;
            border-radius: 12px;
            box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
            margin: 2rem 0;
        }
    </style>
</head>
<body>
    <!-- Hero Section -->
    <section class="relative overflow-hidden bg-gradient-to-br from-indigo-600 via-purple-600 to-pink-500 text-white">
        <div class="absolute inset-0 bg-black opacity-20"></div>
        <div class="relative container mx-auto px-6 py-24 text-center">
            <h1 class="text-5xl md:text-7xl font-bold mb-6 animate-fadeInUp">
                Java数组<span class="block text-3xl md:text-4xl mt-2 font-light">完全指南</span>
            </h1>
            <p class="text-xl md:text-2xl mb-8 max-w-3xl mx-auto opacity-90 animate-fadeInUp" style="animation-delay: 0.2s">
                深入理解Java中最基础却最重要的数据结构，掌握数组的精髓与实践
            </p>
            <div class="flex justify-center space-x-4 animate-fadeInUp" style="animation-delay: 0.4s">
                <div class="bg-white bg-opacity-20 backdrop-blur-sm rounded-full px-6 py-3">
                    <i class="fas fa-book-open mr-2"></i>全面覆盖
                </div>
                <div class="bg-white bg-opacity-20 backdrop-blur-sm rounded-full px-6 py-3">
                    <i class="fas fa-code mr-2"></i>实战代码
                </div>
                <div class="bg-white bg-opacity-20 backdrop-blur-sm rounded-full px-6 py-3">
                    <i class="fas fa-chart-line mr-2"></i>可视化图解
                </div>
            </div>
        </div>
        <div class="absolute bottom-0 left-0 right-0">
            <svg viewBox="0 0 1440 120" fill="none" xmlns="http://www.w3.org/2000/svg">
                <path d="M0 120L60 105C120 90 240 60 360 45C480 30 600 30 720 37.5C840 45 960 60 1080 67.5C1200 75 1320 75 1380 75L1440 75V120H1380C1320 120 1200 120 1080 120C960 120 840 120 720 120C600 120 480 120 360 120C240 120 120 120 60 120H0Z" fill="white"/>
            </svg>
        </div>
    </section>

    <!-- Main Content -->
    <main class="container mx-auto px-6 py-12 max-w-6xl">
        
        <!-- 数组基本概念 -->
        <section class="mb-16 scroll-reveal">
            <h2 class="text-4xl font-bold mb-8 text-gray-800">
                <span class="title-decoration">数组的基本概念</span>
            </h2>
            <div class="bg-white rounded-2xl shadow-xl p-8">
                <p class="text-lg leading-relaxed text-gray-700 mb-6 drop-cap">
                    数组是Java中一种重要的数据结构，用于存储相同类型的多个元素。它提供了一个连续的存储空间，每个元素通过索引来访问，索引从0开始递增。
                </p>
                
                <div class="image-container">
                    <img src="https://cdn.nlark.com/yuque/0/2024/png/21449790/1709693394311-848d92a8-4342-42a2-ba5f-67f492691e1d.png" alt="数组结构示意图">
                </div>
                
                <p class="text-lg leading-relaxed text-gray-700">
                    数组长度在创建时确定且不可变，因此必须在声明时指定长度。数组的元素可以是基本数据类型或对象，但所有元素类型必须相同。数组的优点包括快速访问元素、内存紧凑、性能高效。然而，数组的长度固定且不可变，无法动态调整，且需要连续的内存空间，因此在某些情况下可能不太灵活。掌握数组的使用对于Java程序员至关重要，它是构建更复杂数据结构和算法的基础。
                </p>
            </div>
        </section>

        <!-- 数组的特点 -->
        <section class="mb-16 scroll-reveal">
            <h2 class="text-4xl font-bold mb-8 text-gray-800">
                <span class="title-decoration">数组的特点</span>
            </h2>
            
            <div class="image-container mb-8">
                <img src="https://cdn.nlark.com/yuque/0/2024/png/21449790/1709693463276-06f23a65-d539-4bfa-9f52-a479e3df2f53.png" alt="数组特点图解">
            </div>
            
            <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
                <div class="feature-card bg-white rounded-xl shadow-lg p-6 border-t-4 border-indigo-500">
                    <div class="flex items-center mb-4">
                        <div class="bg-indigo-100 rounded-full p-3 mr-4">
                            <i class="fas fa-lock text-indigo-600 text-xl"></i>
                        </div>
                        <h3 class="text-xl font-bold text-gray-800">固定长度</h3>
                    </div>
                    <p class="text-gray-600">数组在创建时需要指定长度，并且长度在数组生命周期内不可变。</p>
                </div>
                
                <div class="feature-card bg-white rounded-xl shadow-lg p-6 border-t-4 border-purple-500">
                    <div class="flex items-center mb-4">
                        <div class="bg-purple-100 rounded-full p-3 mr-4">
                            <i class="fas fa-equals text-purple-600 text-xl"></i>
                        </div>
                        <h3 class="text-xl font-bold text-gray-800">相同类型</h3>
                    </div>
                    <p class="text-gray-600">数组中的元素必须是相同类型，可以是基本数据类型或者对象类型。</p>
                </div>
                
                <div class="feature-card bg-white rounded-xl shadow-lg p-6 border-t-4 border-pink-500">
                    <div class="flex items-center mb-4">
                        <div class="bg-pink-100 rounded-full p-3 mr-4">
                            <i class="fas fa-memory text-pink-600 text-xl"></i>
                        </div>
                        <h3 class="text-xl font-bold text-gray-800">连续内存空间</h3>
                    </div>
                    <p class="text-gray-600">数组中的元素在内存中是连续存储的，这样可以通过索引高效地访问元素。</p>
                </div>
                
                <div class="feature-card bg-white rounded-xl shadow-lg p-6 border-t-4 border-green-500">
                    <div class="flex items-center mb-4">
                        <div class="bg-green-100 rounded-full p-3 mr-4">
                            <i class="fas fa-list-ol text-green-600 text-xl"></i>
                        </div>
                        <h3 class="text-xl font-bold text-gray-800">下标访问</h3>
                    </div>
                    <p class="text-gray-600">数组中的每个元素都有一个唯一的索引，从0开始递增，可以通过下标快速访问和修改元素。</p>
                </div>
                
                <div class="feature-card bg-white rounded-xl shadow-lg p-6 border-t-4 border-yellow-500">
                    <div class="flex items-center mb-4">
                        <div class="bg-yellow-100 rounded-full p-3 mr-4">
                            <i class="fas fa-cube text-yellow-600 text-xl"></i>
                        </div>
                        <h3 class="text-xl font-bold text-gray-800">静态结构</h3>
                    </div>
                    <p class="text-gray-600">数组的结构是静态的，即在声明时确定数组长度和类型，不支持动态扩展或缩减。</p>
                </div>
                
                <div class="feature-card bg-white rounded-xl shadow-lg p-6 border-t-4 border-red-500">
                    <div class="flex items-center mb-4">
                        <div class="bg-red-100 rounded-full p-3 mr-4">
                            <i class="fas fa-layer-group text-red-600 text-xl"></i>
                        </div>
                        <h3 class="text-xl font-bold text-gray-800">一维或多维</h3>
                    </div>
                    <p class="text-gray-600">数组可以是一维的，也可以是多维的，多维数组由一维数组嵌套构成。</p>
                </div>
            </div>
        </section>

        <!-- 数组基本操作 -->
        <section class="mb-16 scroll-reveal">
            <h2 class="text-4xl font-bold mb-8 text-gray-800">
                <span class="title-decoration">数组基本操作</span>
            </h2>
            
            <div class="space-y-6">
                <!-- 声明数组 -->
                <div class="bg-